This invention relates in general to computer software and, more specifically, to devices and methods for releasing an in-memory executable image (e.g., an executing partitioning program) from its dependence on a backing store (e.g., an executable file stored on a hard disk being partitioned by the partitioning program).
xe2x80x9cPartitioningxe2x80x9d refers to a process by which a computer storage device, such as a hard disk, is divided into multiple logical devices. For example, a computer user wishing to run both the Windows NT(copyright) and Linux(copyright) operating systems from a single hard disk might partition the disk into two logical devicesxe2x80x94one for running Windows NT(copyright), and the other for running Linux(copyright).
The assignee of this invention, PowerQuest Corporation, has developed partitioning software (referred to as xe2x80x9cPartitionMagic(copyright)xe2x80x9d) to assist computer users in the partitioning process described above. Various implementations of this software are described in detail in U.S. Pat. Nos. 5,675,769 and 5,706,472 to Ruff et al., and U.S. Pat. No. 5,930,831 to Marsh et al.
When running as a Win32 program (i.e., a 32-bit Windows(copyright) program) under the Windows NT(copyright) operating system, PartitionMagic(copyright) can only operate on partitions that have no open files. Since the Windows NT(copyright) operating system always has at least some open files running from its own partition, PartitionMagic(copyright) cannot operate on the Windows NT(copyright) partition when it runs as a Win32 program.
Accordingly, PartitionMagic(copyright) has been designed to also run in the Windows NT(copyright) boot mode, where it can operate on all partitions, including the Windows NT(copyright) partition. In this mode, the Windows NT(copyright) kernel loads first. The kernel then loads any device drivers. A portion of the kernel referred to as the xe2x80x9cSession Managerxe2x80x9d then executes any programs that require hard disk access before the Windows(copyright) user interface is loaded. In addition to PartitionMagic(copyright), such programs include xe2x80x98autochk.exexe2x80x99 (a utility for checking the condition of the hard disk) and xe2x80x98autoconv.exexe2x80x99 (a utility for performing file system conversions), both from Microsoft(copyright) Corporation, and xe2x80x98autofat.exexe2x80x99 and xe2x80x98autontfs.exexe2x80x99 (utilities for file defragmentation), both from Executive Software, Inc. Once these programs have executed, the Session Manager generally loads the Windows(copyright) user interface to initiate the Windows NT(copyright) Win32 mode, although PartitionMagic(copyright) reboots instead.
As shown in FIG. 1, a program, such as PartitionMagic(copyright), running in Windows NT(copyright) boot mode generally includes an in-memory executable image 10 stored in computer memory 12, and an executable file 14 (referred to as a xe2x80x9cbacking storexe2x80x9d) stored on a hard disk 16. The in-memory executable image 10 is allocated a range of the memory 12xe2x80x94referred to as its xe2x80x9cworking setxe2x80x9d xe2x80x94that is something less than is required to load the entire program into the memory 12 from the executable file 14. In order to run the entire program, the Windows NT(copyright) kernel pages (i.e., swaps) portions of the executable file 14 (e.g., a portion 20) into the in-memory executable image 10 on demand, and in the process overwrites portions of the executable image 10 (e.g., a portion 18) that aren""t immediately needed.
This can be problematic during the partitioning process, because PartitionMagic(copyright) may corrupt the executable file 14 by copying the file 14 to a new location on the hard disk 16 and then overwriting the original location of the file 14 with other data. As a result, when the Windows NT(copyright) kernel attempts to page code from the original location of the executable file 14 into the executable image 10, it is actually paging in foreign data that is not from the executable file 14. This inevitably leads to execution errors in PartitionMagic(copyright) when an attempt is made to execute the foreign data paged into the executable image 14.
Thus, there is a need in the art for a device and method that release an in-memory executable image from its dependence on a backing store, thereby avoiding the possibility of paging foreign data into the executable image.
In one embodiment of this invention, one or more pageable program sections contained in a Windows NT executable file are executed (i.e., run) by first booting into Windows NT boot mode. Then, while in Windows NT boot mode, an in-memory executable image is generated from the executable file, a working set of the executable image is adjusted so the image can accommodate all the pageable program sections of the executable file, all the pageable program sections are locked into the executable image, and the image is executed. This effectively releases the executable image from its dependence on the executable file as its backing store.
The working set of the executable image can be adjusted by, for example, calling a working set Windows NT Application Programming Interface (API) with the necessary working set parameters. Also, the pageable program sections can be locked into the executable image by, for example, passing a base address and a section size for each of the sections to a locking Windows NT API. The base address and section size for each section can be obtained, for example, from fields in a section header associated with each section and contained in the executable file.
In another embodiment of this invention, an in-memory executable image is released from its dependence on a Windows NT executable file containing one or more pageable program sections as its backing store. Specifically, while in Windows NT boot mode, a working set of the in-memory executable image is adjusted so the image can accommodate all the pageable program sections of the Windows NT executable file, and all the pageable program sections are then locked into the in-memory executable image.
In yet another embodiment of this invention, one or more pageable computer program portions contained in an executable file, and capable of corrupting the file upon execution, are executed by generating an in-memory executable image from the file. Enough memory is allocated to the executable image for the image to accommodate all the pageable computer program portions of the executable file. All the pageable computer program portions are then locked into the executable image, and the image is executed, thereby corrupting the executable file. The executable image continues to execute after corrupting the executable file by not paging program portions into the image from the corrupted file.
In still another embodiment of this invention, a storage medium in a computer system is partitioned by providing an executable file (e.g., a Windows NT executable file) on the storage medium containing one or more pageable computer program portions that partition the storage medium. An in-memory executable image is generated from the executable file, and enough memory in the computer system is allocated to the executable image for the image to accommodate all the pageable computer program portions of the executable file. All the pageable computer program portions are locked into the executable image, and the image is executed without paging program portions into the image from the executable file, thereby partitioning the storage medium.
In a further embodiment of this invention, a storage medium in a computer system is partitioned by providing a Windows NT executable file on the storage medium. The file contains pageable computer program sections (e.g., xe2x80x98.textxe2x80x99 and xe2x80x98dataxe2x80x99 sections) that partition the storage medium, and one or more section headers corresponding to the pageable computer program sections, each of which includes a base address and a section size for its corresponding pageable computer program section. The computer system is booted into Windows NT boot mode and, while in Windows NT boot mode, an in-memory executable image is generated from the executable file. A working set Windows NT Application Programming Interface (API) is then called to adjust a working set of the executable image so the image can accommodate all the pageable computer program sections of the executable file. Next, the base address and section size for each pageable computer program section is retrieved from its corresponding section header, and the base address and section size for each section is passed to a locking Windows NT API to lock the section into the executable image. Finally, the executable image is executed without paging program sections into the image from the executable file, thereby partitioning the storage medium.
In a still further embodiment of this invention, a computer program is executed in a computer system by first providing a storage medium in the computer system. The storage medium may comprise, for example, a hard drive, a storage area network, or a storage array. The storage medium has at least one partition thereon generated by providing an executable file on the storage medium containing one or more pageable computer program portions that partition the storage medium, generating an in-memory executable image from the executable file, allocating enough memory in the computer system to the executable image for the image to accommodate all the pageable computer program portions of the executable file, locking all the pageable computer program portions into the executable image, and executing the executable image without paging program portions into the image from the executable file, thereby generating the at least one partition thereon. The computer program is then provided in the partition on the storage medium, and the program is executed from the partition.
In an additional embodiment of this invention, an apparatus for releasing an in-memory executable image from its dependence on a Windows NT executable file containing one or more pageable program sections as its backing store includes a device that adjusts a working set of the in-memory executable image in Windows NT boot mode so the image can accommodate all the pageable program sections of the Windows NT executable file, and a device that locks all the pageable program sections into the in-memory executable image in Windows NT boot mode.
In a still additional embodiment of this invention, an apparatus for executing one or more pageable computer program portions contained in an executable file, and capable of corrupting the executable file upon execution, includes a device that generates an in-memory executable image from the executable file. An allocating device allocates enough memory to the executable image for the image to accommodate all the pageable computer program portions of the executable file, and a locking device locks all the pageable computer program portions into the executable image. Also, an executing device executes the executable image, thereby corrupting the executable file, and then continues to execute the executable image after corrupting the executable file by executing the image without paging program portions into the image from the corrupted executable file.
In yet another additional embodiment of this invention, an electronic system, such as a computer system, incorporates the apparatus described immediately above.
In still another additional embodiment of this invention, a computer-readable medium (e.g., a computer-readable storage medium such as a hard drive, or a signal carrier such as a carrier wave) has one or more computer program portions embodied therein that release an in-memory executable image from its dependence on a Windows NT executable file containing one or more pageable program sections as its backing store. The computer program portions include a computer program portion that adjusts a working set of the in-memory executable image in Windows NT boot mode so the image can accommodate all the pageable program sections of the Windows NT executable file, and a computer program portion that locks all the pageable program sections into the in-memory executable image in Windows NT boot mode.
In another further embodiment of this invention, a computer-readable medium has one or more computer program portions embodied therein for executing a computer program contained in an executable file and capable of corrupting the executable file upon execution. The computer program portions include a computer program portion that generates an in-memory executable image from the executable file, a computer program portion that allocates enough memory to the executable image for the image to accommodate all pageable portions of the computer program, a computer program portion that locks all the pageable portions of the computer program into the executable image, a computer program portion that executes the executable image, thereby corrupting the executable file, and a computer program portion that continues to execute the executable image after corrupting the executable file by executing the image without paging program portions into the image from the corrupted executable file.
In yet another further embodiment of this invention, a functionality-realizing medium (e.g., a computer-readable medium) having functional data (e.g., computer program portions) embodied therein includes a computer program portion that generates an in-memory executable image from an executable file containing a computer program capable of corrupting the executable file upon execution, a computer program portion that allocates enough memory to the executable image for the image to accommodate all pageable portions of the computer program, a computer program portion that locks all the pageable portions of the computer program into the executable image, a computer program portion that executes the executable image, thereby corrupting the executable file, and a computer program portion that continues to execute the executable image after corrupting the executable file by executing the image without paging program portions into the image from the corrupted executable file.